package com.quickdev.intelligenthome.net.data
{
	import com.adobe.serialization.json.JSON;
	import com.quickdev.intelligenthome.config.Config;
	import com.quickdev.intelligenthome.predef.AppPredef;

	public class EnergyRequest extends Base
	{
		//查询类型（日用电量查询，月用电量查询）
		public var queryType :uint;
		//起始日期（日查询格式："2011-01-01", 月查询格式："2011-01"）
		public var startDate :String;
		//结束日期
		public var endDate :String;
		
		public function EnergyRequest()
		{
			super();
			msgType = AppPredef.REQUEST_ENERGY;
		}
		
		public static function test() :EnergyRequest {
			var energyReq :EnergyRequest = new EnergyRequest();
			energyReq.userNo = Config.userNo;
			energyReq.queryType = AppPredef.ENERGY_TYPE_DAY;
			energyReq.startDate = "2010-12-25";
			energyReq.endDate = "2011-01-05";
			
			return energyReq;
		}
		
		override public function encode() :String {
			var obj :Object = new Object();
			obj.msgType = msgType;
			obj.userNo = userNo;
			obj.queryType = queryType;
			obj.startDate = startDate;
			obj.endDate = endDate;
			
			return JSON.encode( obj );
		}
	}
}